package com.zcl.item.client;

import com.zcl.comm.client.ItemClient;
import com.zcl.comm.pojo.TpItem;
import com.zcl.item.service.ItemService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class ItemClientImpl implements ItemClient {
    @Resource
    private ItemService itemService;

    @Value("${eureka.instance.instance-id}")
    private  String instanceId;

    @Override
    public TpItem findById(Integer id) {
        TpItem tpItem=itemService.getById(id);
        tpItem.setItemName(instanceId+":"+tpItem.getItemName());
        return tpItem;
    }
}
